//
//  CellOfNR.m
//  HYHoney
//
//  Created by dllo on 16/1/22.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellOfNR.h"
#import "ModelOfNR.h"
#import "UIImageView+WebCache.h"




@implementation CellOfNR

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self createCell];
    }
    return self;
}


- (void)dealloc{
    
    [_imageI release];
    [_label release];
    [super dealloc];
}


- (void)createCell{

    self.imageI = [[UIImageView alloc] init];
    self.imageI.backgroundColor = [UIColor lightGrayColor];
    [self.contentView addSubview:self.imageI];
    
    self.label = [[UILabel alloc] init];
    self.label.backgroundColor = [UIColor whiteColor];
    self.label.numberOfLines = 0;
    [self.contentView addSubview:self.label];
    
    [self.imageI release];
    [self.label release];
}


- (void)layoutSubviews{

    [super layoutSubviews];
    
    self.imageI.frame = CGRectMake(15, 20, self.frame.size.width - 30, self.frame.size.height - 30);
    self.imageI.layer.shadowColor = [UIColor blackColor].CGColor;
    self.imageI.layer.shadowOffset = CGSizeMake(0.5, 0.5);
    self.imageI.layer.shadowOpacity = 0.5;
    self.imageI.layer.shadowRadius = 10.0;
    //    self.imageI.layer.cornerRadius = 10;
//    self.imageI.layer.masksToBounds = YES;
    
    self.label.frame = CGRectMake(20, self.imageI.center.x, self.imageI.frame.size.width - 40, 40);
    self.label.layer.cornerRadius = 12;
    self.label.center = self.imageI.center;
    self.label.textAlignment = NSTextAlignmentCenter;
    self.label.backgroundColor = [UIColor clearColor];
    self.label.textColor = [UIColor whiteColor];
    self.label.shadowColor = [UIColor blackColor];
    self.label.shadowOffset = CGSizeMake(0.2, 0.5);
    self.label.layer.masksToBounds = YES;
    self.label.font = [UIFont boldSystemFontOfSize:18];

}



- (void)passmodel:(ModelOfNR *)modelNR{

    [self.imageI sd_setImageWithURL:[NSURL URLWithString:modelNR.cover_image_url] placeholderImage:[UIImage imageNamed:@"jzz"]];
    
    self.label.text = modelNR.title;
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
